//
//  QZPopView.m
//  map
//
//  Created by 000 on 16/12/2.
//  Copyright © 2016年 faner. All rights reserved.
//

#import "QZPopView.h"
#import "constant.h"
@interface QZPopView ()

@end

@implementation QZPopView
+ (instancetype)popViewWithFrame:(CGRect)frame
{
    QZPopView *popView = [[NSBundle mainBundle] loadNibNamed:@"QZPopView" owner:nil options:nil].lastObject;
    popView.frame = frame;
    popView.backgroundColor = QZBlackColor;
    //    popView.layer.cornerRadius = 10;
    return popView;
}
- (void)awakeFromNib
{
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
    [self addGestureRecognizer:tapGesture];
}
- (void)show
{
    //    NSLog(@"1----2%@",self.popImageName);
//    self.imageView.image = [UIImage imageNamed:self.imageName];
//    self.goodsNameLabel.text = self.goodsName;
    //获取主Window
    UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
    [keyWindow addSubview:self];
    self.alpha = 0.0f;
    [UIView animateWithDuration:0.3 animations:^{
        self.alpha =1.0f;
    } completion:^(BOOL finished) {
        //弹出键盘
        //        [self.textView becomeFirstResponder];
    }];
}
- (void)hide
{
    [UIView animateWithDuration:0.3f animations:^{
        self.alpha = 0.0f;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}



@end
